/**
 * Copyright (C) 2013 Daniel Gee.
 * See LICENSE.txt for more details.
 */
package quickcheck.generators;

import java.awt.Color;

import net.java.quickcheck.Generator;
import net.java.quickcheck.generator.PrimitiveGenerators;

/**
 * Generates random {@link Color} instances.
 * 
 * @author Daniel Gee
 */
public class ColorGenerator implements Generator<Color>
{

	/**
	 * Used to pick RGB values of generated Colors.
	 */
	private final Generator<Integer> intGen;

	/**
	 * Makes a new ColorGenerator.
	 */
	public ColorGenerator()
	{
		this.intGen = PrimitiveGenerators.integers(0, 255);
	}

	/**
	 * @see net.java.quickcheck.Generator#next()
	 */
	@Override
	public Color next()
	{
		return new Color(intGen.next(), intGen.next(), intGen.next());
	}

}
